<?php
class Admin_Model_DbTable_tour extends Zend_Db_Table_Abstract
{
	 protected $_name = 'hae_tour';
	 protected $_sequence=true;
     protected $_primary='id';
	public function addTour( $name_vi, $name_en, $name_ja, $name_cn, $name_fr,$intro_vi, $intro_en, $intro_ja, $intro_cn, $intro_fr,  $desc_vi, $desc_en, $desc_ja, $desc_cn, $desc_fr, $length_day, $length_night, $price, $image, $tourtypeId, $countryId, $regionId, $cityId, $priority, $inclusion, $exclusion, $cancellation, $cancellation, $theme, $promotionallId, $promotionvipId, $multicountry, $status )
	{ 
		$data = array(
		'name_vi' => $name_vi,
		'name_en' => $name_en,
		'name_ja' => $name_ja,
		'name_cn' => $name_cn,
		'name_fr' => $name_fr,
		'intro_vi' => $intro_vi,
		'intro_en' => $intro_en,
		'intro_ja' => $intro_ja,
		'intro_cn' => $intro_cn,
		'intro_fr' => $intro_fr,
		'desc_vi' => $desc_vi,
		'desc_en' => $desc_en,
		'desc_ja' => $desc_ja,
		'desc_cn' => $desc_cn,
		'desc_fr' => $desc_fr,
		'price' => $price,
		'image' => $image,
		'priority' => $priority,
		'countryId' => $countryId,
		'regionId'  => $regionId,
		'cityId' => $cityId,
		'tourtypeId' => $tourtypeId,
		'length_day' => $length_day,
		'length_night' => $length_night,
		'inclusions' => $inclusion,
		'exclusions' => $exclusion,
		'cancellation' => $cancellation,
		'theme' => $theme,
		'promotionallId' => $promotionallId,
		'promotionvipId' => $promotionvipId,
		'multicountry' =>$multicountry,
		'status' => $status,
		);
		return $this->insert($data);
	}
	public function getTour($id)
	{
	    $id = (int)$id;
	    $row = $this->fetchRow('id=' . $id);
		if(!$row)
		{ 
			throw  new Exception("Could not find row {$id}");
		}
		return $row->toArray();
	}
	public function updateTour($id, $name_vi, $name_en, $name_ja, $name_cn, $name_fr,$intro_vi, $intro_en, $intro_ja, $intro_cn, $intro_fr,  $desc_vi, $desc_en, $desc_ja, $desc_cn, $desc_fr, $length_day, $length_night, $price, $image, $tourtypeId, $countryId, $regionId, $cityId, $priority, $inclusion, $exclusion, $cancellation, $cancellation, $theme, $promotionallId, $promotionvipId, $multicountry, $status )
	{
		$data = array(
		'name_vi' => $name_vi,
		'name_en' => $name_en,
		'name_ja' => $name_ja,
		'name_cn' => $name_cn,
		'name_fr' => $name_fr,
		'intro_vi' => $intro_vi,
		'intro_en' => $intro_en,
		'intro_ja' => $intro_ja,
		'intro_cn' => $intro_cn,
		'intro_fr' => $intro_fr,
		'desc_vi' => $desc_vi,
		'desc_en' => $desc_en,
		'desc_ja' => $desc_ja,
		'desc_cn' => $desc_cn,
		'desc_fr' => $desc_fr,
		'price' => $price,
		'image' => $image,
		'priority' => $priority,
		'countryId' => $countryId,
		'regionId'  => $regionId,
		'cityId' => $cityId,
		'tourtypeId' => $tourtypeId,
		'length_day' => $length_day,
		'length_night' => $length_night,
		'inclusions' => $inclusion,
		'exclusions' => $exclusion,
		'cancellation' => $cancellation,
		'theme' => $theme,
		'promotionallId' => $promotionallId,
		'promotionvipId' => $promotionvipId,
		'multicountry' =>$multicountry,
		'status' => $status,
		);
		$this->update($data, 'id = '. (int)$id);
	}
	public function changestatus($id,$status)
	{
		$data = array(
		'status' => $status,
		);
		$this->update($data, 'id = '. (int)$id);
	}
	public function changepriority($id,$priority)
	{
		$data = array(
		'priority' => $priority,
		);
		$this->update($data, 'id = '. (int)$id);
	}
	public function deletetour($id)
    {
        return $this->delete('id =' . (int)$id);
    }
}
?>